home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8092 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.0 KB  |  35 lines

  1. Path: airdmhor.gen.nz!not-for-mail
  2. From: gumboot@airdmhor.gen.nz (Simon Hosie)
  3. Newsgroups: comp.lang.c,comp.lang.c++
  4. Subject: Re: New printf - like function, is it possible?
  5. Followup-To: comp.lang.c,comp.lang.c++
  6. Date: 15 Feb 1996 04:39:05 +1300
  7. Organization: Airdmhor : a couple of BBS's, a bunch of people, and a cat.
  8. Message-ID: <4fsvmp$esi@airdmhor.gen.nz>
  9. References: <4eqb3a$2r5@pan.otol.fi>
  10. NNTP-Posting-Host: airdmhor.gen.nz
  11. X-Newsreader: TIN [version 1.2 PL2]
  12.  
  13. Timo Sakari:
  14. > However, I want to write a "better" printing function, where string to be
  15. > formed doesn't need to be formatted first, it can be displayed and formed
  16. > at the same time in the same syntax like printf, something like these:
  17.  
  18.  
  19. #include <stdarg.h>
  20.  
  21. typeA PrintfToWin(typeB x, const char *Format, ...)
  22. {
  23.     TypeA               ReturnVal;
  24.     const char          Buffer[1025];
  25.     va_list             ArgPtr;
  26.  
  27.     va_start(ArgPtr, Format);
  28.     vsprintf(Buffer, Format, ArgPtr);
  29.     va_end(ArgPtr);
  30.  
  31.     reutrn PutsToWin(DEBUG_WIN_1, Buffer);
  32. }
  33.  
  34.   Does that look like what you want? 
  35.